/*
 * @Author: chen haoxuan
 * @Date: 2021-06-17 07:54:09
 * @LastEditTime: 2021-06-17 07:56:09
 */
#include <iostream>
#include <cmath>
using namespace std;
class Ctriangle
{
public:
    void get_date();
    void get_area();

private:
    float a;
    float b;
    float c;
    float area;
};
void Ctriangle::get_date()
{
    cout << "Please enter the three sides of the triangle ";
    cin >> a;
    cin >> b;
    cin >> c;
    int m=0;
    if (a + b <= c || a + c <= b || b + c <= a)   // 判断用户输入的边能否组成三角形
    {
        cout << "can not form ctriangle " << endl;
        cout << "enter 0 to out the program:";
        cin>>m;
        exit(m);
    }
    else
    {
        cout << "Ctriangle: "
             << "a=" << a << " b=" << b << " c=" << c << endl;
    }
}
void Ctriangle::get_area()
{
    float length = a + b + c;
    float p = length / 2;
    area = pow(p * (p - a) * (p - b) * (p - c), 0.5);
    cout << "area: " << area << endl;
}
int main()
{
    Ctriangle c1;
    c1.get_date();
    c1.get_area();
    system("pause");
    return 0;
}
